package com.naiterui.ehp.bs.recommend.controller.inner;


import com.naiterui.common.repository.page.PageParamVO;
import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.bo.recommend.MedicationRecomPaBO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.recommend.exception.ExceptionCodes;
import com.naiterui.ehp.bs.recommend.service.IDrPtRecomService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author guoyongxiang
 * @date 2019-06-28 19:53
 * @since 1.0.0
 */
@Api(tags = {SwaggerTag.INNER_API + SwaggerTag.RECOM, SwaggerTag.PATIENT + SwaggerTag.RECOM})
@RequestMapping("recommend/inner/pt/recom")
@RestController
public class InnerRecomPtController {

    @Autowired
    private IDrPtRecomService drPtRecomService;

    /**
     * 患者端处方列表
     *
     * @param patientId
     * @param doctorId
     * @param consultId
     * @param page
     * @param num
     * @return
     */
    @RequestMapping("drugList")
    public ResponseVO<PageVO<MedicationRecomPaBO>> getRecomDrugList(Long patientId, Long doctorId, Long consultId, int page, int num) {
        PageVO<MedicationRecomPaBO> pageVO = drPtRecomService.getRecomDrugList(patientId, doctorId, consultId, page, num);
        return PublicService.returnResponseVO(ExceptionCodes.SUCCESS, pageVO);
    }

    /**
     * 患者处方列表
     *
     * @param patientId
     * @param paramVO
     * @return
     */
    @GetMapping("/list")
    public ResponseVO<PageVO<MedicationRecomPaBO>> getPatientRecomList(Long patientId, Integer page, Integer num, Integer status, Integer type) {
        return PublicService.returnResponseVO(drPtRecomService.getPatientRecomList(patientId, new PageParamVO(page, num), status , type));
    }
}
